<?php 
  // Include Lib path
  set_include_path('/home/servers/labs.geeek.org/lib/' . PATH_SEPARATOR . get_include_path());

  // this defines some of your basic setup
  include_once 'config.php';
  include_once 'lib.php';

  // Facebook API
  include_once 'facebook-platform/php/facebook.php';
 
  $facebook = new Facebook($facebook_api_key, $facebook_secret);
  $facebook->require_frame();

  $is_tab = isset($_POST['fb_sig_in_profile_tab']);

  if( !$is_tab ){
	$facebook_uid = $facebook->require_login(); 
  } else {
        $facebook_uid = $facebook->get_profile_user();
  }
 
  if (isset($_POST['latitude_uid'])){
	 createOrUpdateUser($facebook_uid,$_POST['latitude_uid']);
  } 

  $user = getUser($facebook_uid);

?>
<fb:fbml>
<h1>Mappy Latitude</h1>
<br/>
<fb:tabs>
  <fb:tab-item href='index.php' title='Map' />
  <fb:tab-item href='settings.php' title='Paramètres' selected='true' />
</fb:tabs>

<form method="post" >
 	<br/>
	<label for="latitude_uid">Votre identifiant Google Latitude : </label>
	<input id="latitude_uid"  type="text" value="<?php echo $user->latitude_uid ?>" name="latitude_uid"/>
	<br/><small>Votre identifiant Google Latitude est indiqué tout en bas de <a href="http://www.google.com/latitude/apps/badge?hl=fr">la page Google Latitude Badge</a></small><br/><br/>
	<input type="submit" value="Enregistrer" />
</form>


<fb:google-analytics uacct="UA-605163-22" />

</fb:fbml>

